import { getSearchList } from '@/api'

const state = {
    searchs: []
}

const mutations = {
    GetSearchs(state, val) {
        state.searchs = val
    }
}

const actions = {
    async getSearchs({ commit }, data) {
        let result = await getSearchList(data)
        if (result.code == '200') {
            commit('GetSearchs', result.data)
        }

    }
}

const getters = {
    attrsList(state) {
        return state.searchs.attrsList || []
    },
    goodsList(state) {
        return state.searchs.goodsList || []
    },
    trademarkList(state) {
        return state.searchs.trademarkList || []
    },
    total(state) {
        return state.searchs.total || 0
    }
}

export default {
    namespaced: true,
    state, mutations, actions, getters
}
